<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<h:head>
	<title></title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta http-equiv="content-type" content="multipart/form-data"
		charset="utf-8" />
	<link href="recursos/estilo.css" rel="stylesheet" type="text/css"
		media="screen" />
</h:head>

<h:body>
	<ui:composition template="template/common.xhtml">
		<ui:define name="content">
			<div class="post"><h:form id="listaTimes" prependId="false">
				<p:panel id="pnlTimes" header="#{msg.times}">
					<p:messages />
					<p:dataTable
						paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						paginator="true" paginatorAlwaysVisible="false" rows="10"   rowsPerPageTemplate="10,15,20" paginatorPosition="bottom"
						value="#{timeMB.times}" var="time">
						<p:column filterBy="#{time.nome}" sortBy="#{time.nome}"
							headerText="#{msg.nome}">
							<h:outputText value="#{time.nome}" />
						</p:column>
						<p:column headerText="#{msg.escudo}">
							<p:graphicImage width="30" height="30" value="#{timeMB.path}#{time.imagem}" />
						</p:column>
						<p:column style="text-align:center;" headerText="#{msg.opcoes}">

							<p:commandLink action="alterartime?faces-redirect=true">
								<h:graphicImage url="recursos/images/edit.png" />
								<f:setPropertyActionListener target="#{timeMB.time}"
									value="#{time}"></f:setPropertyActionListener>
							</p:commandLink>
							<p:spacer width="5" />
							<p:commandLink onclick="dlg.show()">
								<h:graphicImage url="recursos/images/trash.png" />
								<f:setPropertyActionListener  target="#{timeMB.time}"
									value="#{time}"></f:setPropertyActionListener>
							</p:commandLink>

						</p:column>
					</p:dataTable>
					<p:commandButton value="#{msg.addnovo}" action="#{timeMB.preIncluir}"/>
				</p:panel>
				<p:confirmDialog message="#{msg.desejaExcluirTime}" id="dialog"
					widgetVar="dlg" modal="true">

					<p:commandButton value="#{msg.sim}" update="pnlTimes"
						action="#{timeMB.excluir}" oncomplete="dlg.hide()" />
					<p:commandButton value="#{msg.nao}" onclick="dlg.hide();" />


				</p:confirmDialog>
			</h:form></div>

		</ui:define>


	</ui:composition>
</h:body>
</html>